<?php

namespace Apps\Common\Models;

/**
 * 用户消息Model
 * @author     chenxiaolin
 * @date        2016年1月19日
 * @version     2.0.0
 * @copyright   Copyright 2016 meelier.com
 */
class UserMessage extends \PhalconPlus\Database\Model
{

    /**
     *
     * @var integer
     */
    public $message_id;

    /**
     *
     * @var integer
     */
    public $user_id;

    /**
     *
     * @var integer
     */
    public $from_user_id;

    /**
     *
     * @var string
     */
    public $from_user_name;

    /**
     *
     * @var string
     */
    public $from_user_cover;

    /**
     *
     * @var string
     */
    public $message_content;

    /**
     *
     * @var string
     */
    public $message_link_type;

    /**
     *
     * @var string
     */
    public $message_link_data;

    /**
     *
     * @var integer
     */
    public $message_state;

    /**
     *
     * @var string
     */
    public $message_read_time;

    /**
     *
     * @var string
     */
    public $message_addtime;
	
    public $push_type;
    
    public $is_read_b;
    
    public $shop_id;
    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'user_message';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return UserMessage[]
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return UserMessage
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

    /**
     * Independent Column Mapping.
     * Keys are the real names in the table and the values their names in the application
     *
     * @return array
     */
    public function columnMap()
    {
        return array(
            'message_id' => 'message_id',
            'user_id' => 'user_id',
            'from_user_id' => 'from_user_id',
            'from_user_name' => 'from_user_name',
            'from_user_cover' => 'from_user_cover',
            'message_content' => 'message_content',
            'message_link_type' => 'message_link_type',
            'message_link_data' => 'message_link_data',
            'message_state' => 'message_state',
            'message_read_time' => 'message_read_time',
            'message_addtime' => 'message_addtime',
        	'push_type'=>'push_type',
        	'is_read_b'=>'is_read_b',
        	'shop_id'=>'shop_id'
        );
    }

    public function defaultColumns()
    {
        return [
            'message_state',
            'message_link_data',
            'message_read_time',
            'message_addtime',
            'from_user_name',
            'from_user_cover'
        ];
    }

}
